using System;
using System.Data;

using Wicresoft.Common;

namespace Wicresoft.Messages.Entity
{
    [Table("FailedMessage", "", "Wicresoft.Messages.ConnectionString")]
    public class FailedMessage : Info
    {
        #region SQL column name consts
        public const string SQLCOL_FAILEDMESSAGEID = "FailedMessageID";
        public const string SQLCOL_MESSAGEID = "MessageID";
        public const string SQLCOL_DEVICERECEIVERS = "DeviceReceivers";
        public const string SQLCOL_PROCESSSTATUS = "ProcessStatus";
        public const string SQLCOL_PROCESSCOUNT = "ProcessCount";
        public const string SQLCOL_PROCESSTIME = "ProcessTime";
        #endregion


        #region Contructors
        /// <summary>
        /// Construct empty entity
        /// </summary>
        public FailedMessage() { }

        /// <summary>
        /// Construct entity by primary key, other fields will be assigned by 
        /// "Load" method.
        /// </summary>
        public FailedMessage(Guid FailedMessageID)
        {
            this.FailedMessageID = FailedMessageID;
        }
        #endregion

        public override void Init(DataRow row)
        {
            FailedMessageID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_FAILEDMESSAGEID]);
            MessageID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_MESSAGEID]);
            DeviceReceivers = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_DEVICERECEIVERS]);
            ProcessStatus = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_PROCESSSTATUS]);
            ProcessCount = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_PROCESSCOUNT]);
            ProcessTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_PROCESSTIME]);
        }

        #region Properties
        #region Property <Guid> FailedMessageID
        [Property("FailedMessageID", 16, SqlDbType.UniqueIdentifier, false, true)]
        public Guid FailedMessageID
        {
            get { return _FailedMessageID; }
            set { _FailedMessageID = value; }
        }
        private Guid _FailedMessageID = Guid.Empty;
        #endregion

        #region Property <Guid> MessageID
        [Property("MessageID", 16, SqlDbType.UniqueIdentifier, false, false)]
        public Guid MessageID
        {
            get { return _MessageID; }
            set { _MessageID = value; }
        }
        private Guid _MessageID = Guid.Empty;
        #endregion

        #region Property <string> DeviceReceivers
        [Property("DeviceReceivers", 2147483646, SqlDbType.NText, false, false)]
        public string DeviceReceivers
        {
            get { return _DeviceReceivers; }
            set { _DeviceReceivers = value; }
        }
        private string _DeviceReceivers = null;
        #endregion

        #region Property <int> ProcessStatus
        [Property("ProcessStatus", 4, SqlDbType.Int, false, false)]
        public int ProcessStatus
        {
            get { return _ProcessStatus; }
            set { _ProcessStatus = value; }
        }
        private int _ProcessStatus = int.MinValue;
        #endregion

        #region Property <int> ProcessCount
        [Property("ProcessCount", 4, SqlDbType.Int, false, false)]
        public int ProcessCount
        {
            get { return _ProcessCount; }
            set { _ProcessCount = value; }
        }
        private int _ProcessCount = int.MinValue;
        #endregion

        #region Property <DateTime> ProcessTime
        [Property("ProcessTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime ProcessTime
        {
            get { return _ProcessTime; }
            set { _ProcessTime = value; }
        }
        private DateTime _ProcessTime = DateTime.MinValue;
        #endregion
        #endregion




    }
}
